package request

type Login struct {
	Mobile   string `form:"mobile" json:"mobile" binding:"required,mobile"`
	Password string `form:"password" json:"password" binding:"required"`
}

func (login Login) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"mobile.required":   "手机号码不能为空",
		"mobile.mobile":     "手机号码格式不正确",
		"password.required": "用户密码不能为空",
	}
}

type Adduser struct {
	Name     string `form:"name" json:"name" binding:"required"`
	Mobile   string `form:"mobile" json:"mobile" binding:"required,mobile"`
	Password string `form:"password" json:"password" binding:"required"`
	Email    string `form:"email" json:"email" binding:"-"`
	Realname string `form:"realname" json:"realname" binding:"required"`
	RoleIds  []uint `form:"role_ids" json:"role_ids" binding:"-"`
}

func (adduser Adduser) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"name.required":     "用户名称不能为空",
		"mobile.required":   "手机号码不能为空",
		"mobile.mobile":     "手机号码格式不正确",
		"password.required": "用户密码不能为空",
		"realname.required": "姓名不能为空",
	}
}

type Edituser struct {
	Id uint `form:"id" json:"id" binding:"required"`
	Adduser
}

func (edituser Edituser) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required":       "用户id不能为空",
		"name.required":     "用户名称不能为空",
		"mobile.required":   "手机号码不能为空",
		"mobile.mobile":     "手机号码格式不正确",
		"password.required": "用户密码不能为空",
		"realname.required": "姓名不能为空",
	}
}

type EditStatus struct {
	Id     uint `form:"id" json:"id" binding:"required"`
	Status uint `form:"status" json:"status" binding:"required,status"`
}

func (editStatus EditStatus) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required":     "用户id不能为空",
		"status.required": "用户状态不能为空", //1 启用 2禁用
		"status.status":   "status值为1或2",
	}
}

type GetUserList struct {
	List
}

type List struct {
	Page     uint   `form:"page" json:"page" default:"1"`
	Length   uint   `form:"length" json:"length" default:"10"`
	Keywords string `form:"keywords" json:"keywords" default:""`
}
